package com.flca.frw.zk.validate;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Constraint;

public class ValidateEmailAddress implements Constraint {

	public void validate(Component aComp, Object aValue)
			throws WrongValueException 
	{
		// Todo move code to Validator
		
		if (aValue != null && aValue instanceof String) {
			String s = (String) aValue;
			if (s.indexOf("@") <= 0 ||
				s.indexOf(".") <= 0) {
				
				throw new WrongValueException(aComp, "Geen geldig email adres");
			}
		}
	}

}
